package com.lyn.cn.ui.activity;

import android.view.View;

import com.lyn.dialog.FileDialog;
import com.lyn.module_custom_base.avtivity.BaseActivity;
import com.lyn.cn.databinding.ActivityMainBinding;
import com.lyn.module_custom_utils.file.FileUtil;
import com.lyn.module_custom_utils.log.LogUtil;

import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;

public class MainActivity extends BaseActivity<ActivityMainBinding> {

    @Override
    public ActivityMainBinding getBinding() {
        return ActivityMainBinding.inflate(getLayoutInflater());
    }

    @Override
    public void setBinding(ActivityMainBinding binding) {
        String modePath = FileUtil.getAndroidDataPath(context, "modePath");
        try {
            String[] fileArray = getAssets().list("");
            if (fileArray == null) {
                LogUtil.e("fileArray==null");
                return;
            }
            for (String fileName : fileArray) {
                LogUtil.e("fileName:" + fileName);
                InputStream inputStream = getAssets().open(fileName);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    public void setListener(ActivityMainBinding binding) {

    }

    @Override
    public boolean onBack() {
        return true;
    }

    public void hello(View view) {
        FileDialog fileDialog = new FileDialog(context);
        fileDialog.setFileDialogCallBack((isFile, path, file) -> LogUtil.e(path));
        fileDialog.show();
    }
}